package com.dxx.cloud.admin.constant;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 37048
 */
public class CommonConst {

    public static class RouterPath {
        public static final String ADMIN = "/admin";
        public static final String TOC = "/toc";
    }

    /**
     * 默认商品规格
     */
    public static final String DEFAULT_SIZE_UNIT = "";

    public static class EntityStatus {
        public static final Integer DELETED = 1;
        public static final Integer NOT_DELETED = 0;

    }

    public static class Lang{
        public static final String ZhongWen = "zh";
        public static final String ENGLISH = "en";
    }

    public static boolean CHECK_DEVICE_AUTH = true;
    public static final Integer IS_ALL_DEVICES = 1;
    public static final Integer MERID_FOR_ALL_DEVICE = 0;
    public static final Integer DEFAULT_TIME_AREA = 8;


    /**
     * 订单支付状态
     */
    public enum OrderPayStatusEnum {
        PAYING(1,"待支付"),
        PAYED(2,"已支付"),
        REFUND(3,"已退款"),
        CANCELED(4,"已取消"),
        ;

        private final Integer code;
        private final String name;

        OrderPayStatusEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static OrderPayStatusEnum getPayStatus(Integer payStatus){
            for (OrderPayStatusEnum payStatusEnum : OrderPayStatusEnum.values()) {
                if (payStatusEnum.getCode().equals(payStatus)) {
                    return payStatusEnum;
                }
            }
            return null;
        }

        public static String getPayStatusDesc(Integer payStatus){
            String desc = null;
            final OrderPayStatusEnum payStatusEnum = getPayStatus(payStatus);
            if (null != payStatusEnum) {
                desc = payStatusEnum.getName();
            }
            return desc;
        }
    }

    /**
     * 结算方式
     */
    public static class PayType{
        //支付类型:1现金 2欠账 3银行卡 4其他 5存款
        public static final Integer CASH = 1;
        public static final Integer OWE = 2;
        public static final Integer BANK_CARD = 3;
        public static final Integer OTHER_PLATFORM = 4;
        public static final Integer DEPOSIT = 5;
        // 11门店微信二维码 12微信客户主扫 13微信客户被扫 14微信刷脸
        public static final Integer WX_QR_CODE = 11;
        public static final Integer WX_SCAN_1 = 12;
        public static final Integer WX_SCAN_2 = 13;
        public static final Integer WX_FACE = 14;
        // 21门店支付宝二维码 22支付宝客户扫商户 23支付宝商户扫客户
        public static final Integer ZFB_QR_CODE = 21;
        public static final Integer ZFB_SCAN_1 = 22;
        public static final Integer ZFB_SCAN_2 = 23;
        // 31易收宝客户扫商户 32易收宝商户扫客户
        public static final Integer NB_QR_CODE = 30;
        public static final Integer NB_SCAN_1 = 31;
        public static final Integer NB_SCAN_2 = 32;

        // 31易收宝客户扫商户 32易收宝商户扫客户
        public static final Integer HEMA_SCAN_1 = 41;
        public static final Integer HEMA_SCAN_2 = 42;

        // 杭州银行收款码
        public static final Integer HANGZHOU_QR_CODE = 50;
        public static final Integer HANGZHOU_SCAN_1 = 51;
        public static final Integer HANGZHOU_SCAN_2 = 52;


        public static final List<Integer> WX_PAY_TYPE_LIST = Arrays.asList(WX_QR_CODE,WX_SCAN_1,WX_SCAN_2,WX_FACE);
        public static final List<Integer> ZFB_PAY_TYPE_LIST = Arrays.asList(ZFB_QR_CODE,ZFB_SCAN_1,ZFB_SCAN_2);
        public static final List<Integer> NB_PAY_TYPE_LIST = Arrays.asList(NB_QR_CODE,NB_SCAN_1,NB_SCAN_2);
        public static final List<Integer> HEMA_PAY_TYPE_LIST = Arrays.asList(HEMA_SCAN_1,HEMA_SCAN_2);
        public static final List<Integer> HANGZHOU_PAY_TYPE_LIST = Arrays.asList(HANGZHOU_QR_CODE,HANGZHOU_SCAN_2);
        //需要回调的支付类型
        public static final List<Integer> PAYED_WITH_CALL_BACK = Arrays.asList(WX_SCAN_1,WX_SCAN_2,WX_FACE,ZFB_SCAN_1,ZFB_SCAN_2,NB_SCAN_1,NB_SCAN_2
                ,HEMA_SCAN_1,HEMA_SCAN_2,HANGZHOU_QR_CODE,HANGZHOU_SCAN_1,HANGZHOU_SCAN_2);
        //被扫支付
        public static final List<Integer> SCAN_2_LIST = Arrays.asList(WX_SCAN_2,ZFB_SCAN_2,NB_SCAN_2);
        public static final Map<Integer,String> typeDescMap = new HashMap<Integer,String>(){
            {
                put(CASH,"现金");
                put(OWE,"欠款");
                put(BANK_CARD,"银行卡");
                put(OTHER_PLATFORM,"其他");
                put(DEPOSIT,"存款");
                put(WX_QR_CODE,"微信二维码");
                put(WX_SCAN_1,"微信客户主扫");
                put(WX_SCAN_2,"微信客户被扫");
                put(WX_FACE,"微信刷脸");
                put(ZFB_QR_CODE,"支付宝二维码");
                put(ZFB_SCAN_1,"支付宝客户扫商户");
                put(ZFB_SCAN_2,"支付宝商户扫客户");
                put(NB_QR_CODE,"易收宝商户二维码");
                put(NB_SCAN_1,"易收宝客户扫商户");
                put(NB_SCAN_2,"易收宝商户扫客户");
                put(HEMA_SCAN_1,"杉德河马商户扫客户");
                put(HEMA_SCAN_2,"杉德河马客户扫商户");
                put(HANGZHOU_QR_CODE,"杭州银行二维码");
                put(HANGZHOU_SCAN_2,"杭州银行客户扫商户");
            }
        };
        public static String getPayTypeDesc(Integer payType){
            String desc = typeDescMap.get(payType);
            return null == desc?"":desc;
        }
    }

    public static class RoundType{
        //执行标准四舍五入
        public static final Integer ROUND = 1;
    }
}
